import { useLanguageStore } from '@/stores/language';

export default {
  install(app) {
    const store = useLanguageStore();
    
    // 提供全局属性
    app.config.globalProperties.$t = (key) => store.t(key);
    
    // 提供全局方法
    app.provide('i18n', {
      t: (key) => store.t(key),
      switchLanguage: store.switchLanguage,
      currentLang: store.currentLang
    });
    
    // 注册全局组件
    app.component('Translate', {
      props: ['key'],
      setup(props) {
        const store = useLanguageStore();
        return () => store.t(props.key);
      }
    });
  }
};